package com.ruoyi.charging.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.charging.mapper.ChargingVehicleMapper;
import com.ruoyi.charging.domain.ChargingVehicle;
import com.ruoyi.charging.service.IChargingVehicleService;

/**
 * 车辆Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-09-06
 */
@Service
public class ChargingVehicleServiceImpl implements IChargingVehicleService 
{
    @Autowired
    private ChargingVehicleMapper chargingVehicleMapper;

    /**
     * 查询车辆
     * 
     * @param id 车辆主键
     * @return 车辆
     */
    @Override
    public ChargingVehicle selectChargingVehicleById(Long id)
    {
        return chargingVehicleMapper.selectChargingVehicleById(id);
    }

    /**
     * 查询车辆列表
     * 
     * @param chargingVehicle 车辆
     * @return 车辆
     */
    @Override
    public List<ChargingVehicle> selectChargingVehicleList(ChargingVehicle chargingVehicle)
    {
        return chargingVehicleMapper.selectChargingVehicleList(chargingVehicle);
    }

    /**
     * 新增车辆
     * 
     * @param chargingVehicle 车辆
     * @return 结果
     */
    @Override
    public int insertChargingVehicle(ChargingVehicle chargingVehicle)
    {
        chargingVehicle.setCreateTime(DateUtils.getNowDate());
        return chargingVehicleMapper.insertChargingVehicle(chargingVehicle);
    }

    /**
     * 修改车辆
     * 
     * @param chargingVehicle 车辆
     * @return 结果
     */
    @Override
    public int updateChargingVehicle(ChargingVehicle chargingVehicle)
    {
        chargingVehicle.setUpdateTime(DateUtils.getNowDate());
        return chargingVehicleMapper.updateChargingVehicle(chargingVehicle);
    }

    /**
     * 批量删除车辆
     * 
     * @param ids 需要删除的车辆主键
     * @return 结果
     */
    @Override
    public int deleteChargingVehicleByIds(Long[] ids)
    {
        return chargingVehicleMapper.deleteChargingVehicleByIds(ids);
    }

    /**
     * 删除车辆信息
     * 
     * @param id 车辆主键
     * @return 结果
     */
    @Override
    public int deleteChargingVehicleById(Long id)
    {
        return chargingVehicleMapper.deleteChargingVehicleById(id);
    }
}
